<ui:composition template="/WEB-INF/templates/login-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:param name="pageName" value="Assign Assets" />
	
	<ui:define name="menu"></ui:define>
	<ui:define name="submenu"></ui:define>
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">	
		
		<h:outputText value="Assign Asset(s)" styleClass="outputTextTitle"/>	
		<h:form> 
		 <p:growl/>
		 
		 <p:panel header="Employee Details" rendered="#{assignAssetsBean.activity ne 'viewEmployee'}"> 
		   <h:panelGrid columns="6" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText, employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText" >
		          
           <h:outputLabel value="Asset Code" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.assetReferenceCode}" />
           
           <h:outputLabel value="Request Date" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.requestDate}" >
           		<f:convertDateTime pattern="dd-MMM-yyyy HH:mm a" timeZone="#{assignAssetsBean.timeZone}"/> 
           </h:outputText>

           <h:outputLabel value="Employee Name " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.employee.firstName} #{assignAssetsBean.assetRequest.employee.lastName}" />
           
           <h:outputLabel value="Module Name " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.employee.moduleName}" />
		              
           <h:outputLabel value="Recommended By" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.recommendedBy.firstName} #{assignAssetsBean.assetRequest.recommendedBy.lastName}" />

           <h:outputLabel value="Approved By " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.approvedBy.firstName} #{assignAssetsBean.assetRequest.approvedBy.lastName}"  />
           
           <h:outputLabel value="System Administrator " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.assigedByEmployee.firstName} #{assignAssetsBean.assetRequest.assigedByEmployee.lastName}" />
           
          </h:panelGrid> 
           <h:outputLabel value="Asset Details" style="font-weight:bold;color: #00A2DE;"/>
          <p:dataTable  value="#{assignAssetsBean.assetDetailsList}" var="newAsset" >
		            
		            <p:column headerText="Asset Type"> 
		              	<h:outputText value="#{newAsset.assetType}" />                 
		            </p:column>  
		  
		            <p:column headerText="Required On"> 
		              	<h:outputText value="#{newAsset.requiredDate}" > 
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assignAssetsBean.timeZone}"/>
		              	</h:outputText> 	               
		            </p:column>  
		            
		            <p:column headerText="Return Date"> 
		              	<h:outputText value="#{newAsset.expectedReturnDate}" >
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assignAssetsBean.timeZone}"/>
		              	</h:outputText>                  
		            </p:column>  
		            
		            <p:column headerText="Purpose"> 
		              	<h:outputText value="#{newAsset.purpose}" />  	               
		            </p:column>  
		            
		            <p:column headerText="Remarks"> 
		              	<h:outputText value="#{newAsset.remarks}" />                 
		            </p:column>  
		            
		            <p:column headerText="Status"> 
		            	<h:outputText value="#{newAsset.assetStatus}" />
		            </p:column>
		            
		            <p:column headerText="Assign"> 
		            	<p:commandButton rendered="#{newAsset.assetAssignedStatus eq 'NOT ASSIGNED'}" action="#{assignAssetsBean.assetAssignmentAction}" value="Assign" >			
							<f:param id="assetType" name="assetType" value="#{newAsset.assetType}" />
							<f:param id="assetCode" name="assetCode" value="#{newAsset.assetReferenceCode}" />
							<f:param id="assetDetailsId" name="assetDetailsId" value="#{newAsset.assetDetailsId}" />
						</p:commandButton>
						<h:outputText value="#{newAsset.assetMaster.assetCode}" rendered="#{newAsset.assetAssignedStatus eq 'ASSIGNED'}" />
		            </p:column>
			       
          </p:dataTable><br/>
          
                  <h:panelGrid columns="3">
             	    <h:outputLabel value="Approval Level-1" style="font-weight:bold;color: #00A2DE;"/>
             	    <h:inputHidden /><h:inputHidden />
             	    <h:outputText value="Recommender Status " style="font-weight:bold;" />
             	    <h:outputText value=" : " style="font-weight:bold;" />
		            <h:outputText value="#{assignAssetsBean.assetRequest.recommenderStatus}" />
		            
		            <h:outputText value="Recommender Comments " style="font-weight:bold;" />
		            <h:outputText value=" : " style="font-weight:bold;" />
		            <font face="comic sans MS, new york, times" size="2"><b>#{assignAssetsBean.assetRequest.recommenderComments}</b></font>
		            
		           
		           <h:inputHidden /><h:inputHidden /><br />
		           
		            <h:outputLabel value="Approval Level-2" style="font-weight:bold;color: #00A2DE;"/>
             	    <h:inputHidden /><h:inputHidden />
             	    
		            <h:outputText value="Approver Status " style="font-weight:bold;" />
		            <h:outputText value=" : " style="font-weight:bold;" />
		            <h:outputText value="#{assignAssetsBean.assetRequest.approverStatus}" />
		            
		            <h:outputText value="Approver Comments " style="font-weight:bold;vertical-align:top;" />
		            <h:outputText value=" : " style="font-weight:bold;" />
		            <font face="comic sans MS, new york, times" size="2"><b>#{assignAssetsBean.assetRequest.approverComments}</b></font>		            
             	</h:panelGrid>
          </p:panel>
    
          <h:panelGroup style="float:right;" rendered="#{assignAssetsBean.activity ne 'viewEmployee'}">
          	<p:commandButton type="button"  value="Send Email" onclick="confirmation.show();" />
          	<p:commandButton value="Close" onclick="window.close();" rendered="#{assignAssetsBean.renderCloseButton}"/>
          	<p:commandButton value="Back" onclick="history.back();"  rendered="#{assignAssetsBean.renderBackButton}" />
          </h:panelGroup>
          
          
         <p:confirmDialog widgetVar="confirmation" id="confirmation" severity="alert" message="Do you want to proceed?">
				<h:panelGroup style="text-align: right; float: right;">
					<p:commandButton value="Yes" action="#{assignAssetsBean.sendMailToCandidateAction}" update="@form" oncomplete="confirmation.hide()"/>
					<p:commandButton id="decline" value="No" onclick="confirmation.hide()" type="button" />
				</h:panelGroup>
		</p:confirmDialog>  
		
		<p:panel header="Employee Details" rendered="#{assignAssetsBean.activity eq 'viewEmployee'}">            
           
           <h:panelGrid columns="6" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText, employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText" >
		          
           <h:outputLabel value="Asset Code" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.assetReferenceCode}" />
           
           <h:outputLabel value="Request Date" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.requestDate}" >
           		<f:convertDateTime pattern="dd-MMM-yyyy HH:mm a" timeZone="#{assignAssetsBean.timeZone}"/> 
           </h:outputText>

           <h:outputLabel value="Employee Name " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.employee.firstName} #{assignAssetsBean.assetRequest.employee.lastName}" />
           
           <h:outputLabel value="System Administrator " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.assigedByEmployee.firstName} #{assignAssetsBean.assetRequest.assigedByEmployee.lastName}" />
		              
           <h:outputLabel value="Recommended By" />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.recommendedBy.firstName} #{assignAssetsBean.assetRequest.recommendedBy.lastName}" />

           <h:outputLabel value="Approved By " />
           <h:outputLabel value=":" />
           <h:outputText value="#{assignAssetsBean.assetRequest.approvedBy.firstName} #{assignAssetsBean.assetRequest.approvedBy.lastName}"  />
           
          </h:panelGrid>
          <h:outputFormat value="Asset Details" style="font-weight:bold;color: #00A2DE;" />
           <p:dataTable  value="#{assignAssetsBean.assetDetailsList}" var="newAsset" > 
		            <p:column headerText="Asset Type"> 
		              	<h:outputText value="#{newAsset.assetType}" />                 
		            </p:column>  
		  
		            <p:column headerText="Required On"> 
		              	<h:outputText value="#{newAsset.requiredDate}" > 
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assignAssetsBean.timeZone}"/>
		              	</h:outputText> 	               
		            </p:column>  
		            
		            <p:column headerText="Return Date"> 
		              	<h:outputText value="#{newAsset.expectedReturnDate}" >
		              		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assignAssetsBean.timeZone}"/>
		              	</h:outputText>                  
		            </p:column>  
		            
		            <p:column headerText="Purpose"> 
		              	<h:outputText value="#{newAsset.purpose}" />  	               
		            </p:column>  
		            
		            <p:column headerText="Remarks"> 
		              	<h:outputText value="#{newAsset.remarks}" />                 
		            </p:column>  
		            
		            <p:column headerText="Status"> 
		            	<h:outputText value="#{newAsset.assetStatus}" />
		            </p:column>
		            
		            <p:column headerText="Asset Code"> 
		            	<h:outputText value="#{newAsset.assetMaster.assetCode}" />
		            </p:column>	
		            
		            <p:column headerText="Assigned Date"> 
		            	<h:outputText value="#{newAsset.assetMaster.assignedDate}">
		            		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assignAssetsBean.timeZone}"/>
		            	</h:outputText>
		            </p:column>		
		            
		            <p:column headerText="Asset Details" > 
		             	<p:commandButton icon="ui-icon-search" value="View" oncomplete="assetVeiwDialog.show()" update="@form">
							<f:setPropertyActionListener target="#{assignAssetsBean.viewAssetMaster}" value="#{newAsset}"></f:setPropertyActionListener>
						</p:commandButton>
		            </p:column>       
              </p:dataTable> 
              <br/>
              <p:commandButton value="Close" onclick="window.close();" />     
          </p:panel> 
      
		 <p:dialog hideEffect="fade" showEffect="fade"
				header="View Asset Details "
				id="assetVeiwDialog" widgetVar="assetVeiwDialog" resizable="false"
				modal="true" >
				
				<h:panelGrid columns="6" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText, employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText" >
                			          
			           <h:outputLabel value="Asset Type" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.assetType}" />
			         
			           <h:outputLabel value="Asset Code" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.assetCode}" />
			           
			           <h:outputLabel value="Asset Name" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.assetName}" />
			       
			           <h:outputLabel value="Manufacturer" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.manufacturer}" />
			        
			           <h:outputLabel value="Model" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.model}" />   
			    
			           <h:outputLabel value="Processor" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.processor}" />			       
			       
			           <h:outputLabel value="Hard Disk" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.hardDisk}" />
			         
			           <h:outputLabel value="Serial Number" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.serialNumber}" />
			      
			           <h:outputLabel value="Memory (GB)" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.memory}" />
			    
			           <h:outputLabel value="OS" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.os}" />	
	          </h:panelGrid>	
	          <h:panelGrid >
	                    <h:outputLabel value="Asset Description : " style="font-weight:bold;"/>
			          	<h:outputLabel value="#{assignAssetsBean.viewAssetMaster.assetMaster.assetDescription}" />		              
		      </h:panelGrid>			
						
				<h:panelGroup style="float:right;">								
					<p:commandButton id="closeButton" process="@this" value="Close" oncomplete="assetVeiwDialog.hide()" update="@form"/>
						
				</h:panelGroup>	
			</p:dialog> 
		
		
         
     </h:form>
	</ui:define>
	
</ui:composition>
